package cn.iocoder.yudao.module.promotion.controller.app.wechatService;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.promotion.controller.admin.wechatservice.vo.*;
import cn.iocoder.yudao.module.promotion.convert.wechatservice.WechatServiceConvert;
import cn.iocoder.yudao.module.promotion.dal.dataobject.wechatservice.WechatServiceDO;
import cn.iocoder.yudao.module.promotion.service.wechatservice.WechatServiceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 微信客服")
@RestController
@RequestMapping("/promotion/wechat-service")
@Validated
public class AppWechatServiceController {

    @Resource
    private WechatServiceService wechatServiceService;

    @GetMapping("/getWechatService")
    @Operation(summary = "获得微信客服")
    public CommonResult<WechatServiceRespVO> getWechatService(@Valid WechatServiceExportReqVO pageVO) {
        List<WechatServiceDO> pageResult = wechatServiceService.getWechatService(pageVO);
        return success(WechatServiceConvert.INSTANCE.convert(pageResult.get(0)));
    }
}
